// BFS求连通块数量
#include <bits/stdc++.h>
 
using namespace std;
using ll = long long;

struct Rect {
  ll lx, rx, ly, ry;
};

// 判断两个矩形是否相交
bool intersect(const Rect &a, const Rect &b) {
  ll cx = min(a.rx, b.rx) - max(a.lx, b.lx);
  ll cy = min(a.ry, b.ry) - max(a.ly, b.ly);
  return cx > 0 && cy > 0;
}

int main() {
  int n, x, y;
  cin >> n >> x >> y;

  vector<Rect> rects;
  rects.emplace_back(0, x, 0, y);

  for (int i = 0; i < n; i++) {
    vector<Rect> old;
    swap(rects, old);

    char c;
    int a, b;
    cin >> c >> a >> b;

    for (Rect e : old) {
      if (c == 'X') {
        if (e.lx < a and a < e.rx) {
          rects.emplace_back(e.lx, a, e.ly - b, e.ry - b);
          rects.emplace_back(a, e.rx, e.ly + b, e.ry + b);
        } else if (e.rx <= a) {
          rects.emplace_back(e.lx, e.rx, e.ly - b, e.ry - b);
        } else {
          rects.emplace_back(e.lx, e.rx, e.ly + b, e.ry + b);
        }
      } else {
        if (e.ly < a and a < e.ry) {
          rects.emplace_back(e.lx - b, e.rx - b, e.ly, a);
          rects.emplace_back(e.lx + b, e.rx + b, a, e.ry);
        } else if (e.ry <= a) {
          rects.emplace_back(e.lx - b, e.rx - b, e.ly, e.ry);
        } else {
          rects.emplace_back(e.lx + b, e.rx + b, e.ly, e.ry);
        }
      }
    }
  }

  int m = rects.size();
  vector<vector<int>> graph(m);

  // 构建邻接表
  for (int i = 0; i < m; i++) {
    for (int j = i + 1; j < m; j++) {
      if (intersect(rects[i], rects[j])) {
        graph[i].push_back(j);
        graph[j].push_back(i);
      }
    }
  }

  // BFS求连通块
  vector<bool> visited(m, false);
  vector<ll> areas;

  for (int i = 0; i < m; i++) {
    if (!visited[i]) {
      queue<int> q;
      q.push(i);
      visited[i] = true;
      ll area_sum = 0;

      while (!q.empty()) {
        int curr = q.front();
        q.pop();

        // 计算当前矩形的面积
        Rect r = rects[curr];
        area_sum += (r.rx - r.lx) * (r.ry - r.ly);

        // 遍历邻居
        for (int neighbor : graph[curr]) {
          if (!visited[neighbor]) {
            visited[neighbor] = true;
            q.push(neighbor);
          }
        }
      }

      areas.push_back(area_sum);
    }
  }

  // 排序输出
  sort(areas.begin(), areas.end());
  cout << areas.size() << '\n';
  for (ll a : areas)
    cout << a << ' ';

  return 0;
}
